import request from "@/netword/request";


const fun = {};


// 分页查询所有信息
fun.getList = async (service) => {
    const res = await request({
        url: "/a/content/service/list",
        method: "post",
        params: {
            serviceTitle: service.serviceTitle,
            pageNo: service.pageNo,
            pageSize: service.pageSize,
        }
    })
    return res.data;
}



//保存数据
fun.saveService = async (service) => {
    const res = await request({
        url: "/a/content/service/save",
        method: "put",
        params: {
            serviceImage:service.serviceImage,
            serviceTitle:service.serviceTitle,
            serviceContent:service.serviceContent,
            sort:service.sort,
            remarks:service.remarks,
        }
    })
    return res.data;
}



//更新数据
fun.updateService = async (service) => {
    const res = await request({
        url: "/a/content/service/update",
        method: "post",
        params: {
            id: service.id,
            serviceImage:service.serviceImage,
            serviceTitle:service.serviceTitle,
            serviceContent:service.serviceContent,
            sort:service.sort,
            remarks:service.remarks,
        }
    })
    return res.data;
}



//修改数据状态（正常，停用，删除）
fun.saveStatus = async (id,status) => {
    const res = await request({
        url: "/a/content/service/updateStatus",
        method: "post",
        params: {
            id: id,
            status:status
        }
    })
    return res.data;
}


//查询单条数据
fun.getService = async (id) => {
    const res = await request({
        url: "/a/content/service/get",
        method: "get",
        params: {
            id: id
        }
    })
    return res.data;
}


export default fun;